The BILINEAR function uses a bilinear interpolation algorithm to compute the value of a data array at each of a set of subscript values.
This routine is written in the IDL language. Its source code can be found in the file bilinear.pro in the lib subdirectory of the IDL distribution.
Result = BILINEAR(P, IX, JY [, MISSING=value])
This function returns a two-dimensional interpolated array of the same type as the input array.
A two-dimensional data array.
Arrays containing the X and Y “virtual subscripts” of P for which to interpolate values. IX and JY can be either of the following:
Note: Location points outside the bounds of the array P—that is, elements of the IX or IY arguments that are either less than zero or greater than the largest subscript in the corresponding dimension of P — are interpolated to the closest value within the bounds of the array P.
It is better to use two-dimensional arrays for IX and JY because the algorithm is somewhat faster. If IX and JY are specified as one-dimensional, the returned two-dimensional arrays IX and JY can be re-used on subsequent calls to take advantage of the faster 2D algorithm.
The value to return for elements outside the bounds of P. The bounds of P are 0 to n-1 and 0 to m-1 where P is an n x m array.
Note: If MISSING value is set to a complex number, IDL uses only the real part.
Create a 3 x 3 floating point array P:
P = FINDGEN(3,3)
Suppose we wish to find the value of a point half way between the first and second elements of the first row of P. Create the subscript arrays IX and JY:
IX = 0.5 ;Define the X subscript.
JY = 0.0 ;Define the Y subscript.
Z = BILINEAR(P, IX, JY) ;Interpolate.
PRINT, Z ;Print the value at the point IX,JY within P.
IDL prints:
0.500000
Suppose we wish to find the values of a 2 x 2 array of points in P. Create the subscript arrays IX and JY:
IX = [[0.5, 1.9], [1.1, 2.2]] ;Define the X subscripts.
JY = [[0.1, 0.9], [1.2, 1.8]] ;Define the Y subscripts.
Z = BILINEAR(P, IX, JY) ;Interpolate.
PRINT, Z ;Print the array of values.
IDL prints:
0.800000 4.60000
4.70000 7.40000
Original |
Introduced |
6.1 |
Added MISSING keyword |